package metier.math;

import static org.junit.Assert.assertTrue;
import librairies.liste.interfaces.IListe;
import librairies.liste.list.ListeDC;

import org.junit.Test;

public class OperationTest 
{
	@Test
	public void testAddition()	//ok
	{
		IListe<Number> list = new ListeDC<Number>();
		list.add(1);
		list.add(2.5);
		list.add(null);
		list.add(0.3333);
		
		Double value = Operation.addition(list);
		
		assertTrue(value == 3.8333);
	}

	@Test
	public void testSoustraction()	//ok
	{
		IListe<Number> list = new ListeDC<Number>();
		list.add(1);
		list.add(2.5);
		list.add(null);
		list.add(0.3333);
		
		Double value = Operation.soustraction(list);
		
		assertTrue(value == -1.8333);
	}
	
	@Test
	public void testDivision()	//ok
	{
		IListe<Number> list = new ListeDC<Number>();
		list.add(1);
		list.add(2.5);
		list.add(null);
		list.add(0.3333);
		
		Double value = Operation.division(list);
		
		assertTrue(value == 1.2001200120012003);
	}
	
	@Test
	public void testMultiplication()	//ok
	{
		IListe<Number> list = new ListeDC<Number>();
		list.add(1);
		list.add(2.5);
		list.add(null);
		list.add(0.3333);
		
		Double value = Operation.multiplication(list);
		
		assertTrue(value == 0.8332499999999999);
	}
}
